package com.project.easy.common.sequencer;

import com.project.easy.common.util.util.IPUtil;
import  com.project.easy.common.util.constants.CommonConstant;
import  com.project.easy.common.util.evn.YqkjZysoftEnvironment;

/**
 * @author GreatorMan.cool
 * @copyright: Copyright (c) 2020
 * @company: 扬起科技有限公司
 * @date 2021/10/23 22:53
 * @description:
 */
public abstract class AbstractSequencer {
    /**
     * 获取WorkID
     * @return ID
     */
    protected static Integer getWorkId() {
        Integer number = IPUtil.convertToInt(IPUtil.getLocalIp());
        return  number % 31;
    }
    /**
     * 返回数据中心ID
     * @return 数据中心ID
     */
    protected static Long getDataCenterId() {
        Long aLong = YqkjZysoftEnvironment.getLong(CommonConstant.DATA_CENTER_FLAG, 1L);
        return (aLong % 32);
    }
}
